﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAO;
using DTO;
namespace BUS
{
    public class AccountBUS
    {
        public static bool insertAccount(ACCOUNT mAccount)
        {
            return AccountDAO.insertAccount(mAccount);
        }

        public static bool updateAccount(ACCOUNT mAccount)
        {
            return AccountDAO.updateAccount(mAccount);
        }


        public static ACCOUNT getAccount(string user_login)
        {
            return AccountDAO.getAccount(user_login);
        }

        public static bool DeleteAccount(int IDAccount)
        {
            return AccountDAO.DeleteAccount(IDAccount);
        }

        public static ACCOUNT GetAccount(string UserName, string PassWord)
        {
            return AccountDAO.GetAccount(UserName, PassWord);
        }

        public static ACCOUNT getAccountFromEmail(string user_email)
        {
            try
            {
                return AccountDAO.getAccountFromEmail(user_email);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public static int GetIDMax()
        {
            return AccountDAO.GetIDMax();
        }

        public static bool IsExisting(string UserName, string PassWord)
        {
            return AccountDAO.IsExisting(UserName, PassWord);
        }
        /// <summary>
        /// CÁI NÀY CHỈ DÙNG KHI ĐĂNG KÍ TÀI KHOẢN MỚI ( nếu có 1 username trong Account thì nó trả ra true bất kết cái account đó có thuộc tính visible=true hay = false)
        /// </summary>
        /// <param name="userName"></param>
        /// <returns></returns>
        public static bool CheckIsExisting(string userName)
        {
            return AccountDAO.CheckIsExisting(userName);
        }
    }
}
